# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=py3-charset-normalizer
pkgver=3.3.2
pkgrel=1
pkgdesc="offers you an alternative to Universal Charset Encoding Detector, also known as Chardet"
url="https://github.com/ousret/charset_normalizer"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/c/charset-normalizer/charset-normalizer-$pkgver.tar.gz"
builddir="$srcdir/charset-normalizer-$pkgver"

prepare() {
	default_prepare

	# community/py3-pytest-cov not available
	sed -i '/cov-report/d' setup.cfg
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
227dd9496e080310b3262fe0ffc32b5ebed16e5b3a294877555c0b04dee0cb073a2a0a4fa8dbad3029703ffaf1857acf24d9b87ca74d75fa2f0ba8fd3413e9c4  charset-normalizer-3.3.2.tar.gz
"
